import 'package:mahjong/entity/MessageContext.dart';
import 'package:mahjong/notify/CurrentUserInfo.dart';
import 'package:mahjong/util/AudioPlayUtil.dart';
import 'package:provider/provider.dart';

import 'AbstractMessageHandler.dart';
import 'package:mahjong/const/MahjongConst.dart';

class MessageCardExport extends AbstractMessageHandler {
  void doMessage(MessageContext message) {
    var currentUser = Provider.of<CurrentUserInfo>(navigatorKey.currentContext,
        listen: false);
    if (message.userId != currentUser.userId && message.body != null) {
      diskPartUserProvider[message.userId].otherExport(message.body);
      AudioPlayUtil.playExportCard(message.body);
    }
    diskPartUserProvider.forEach((key, value) {
      if (key != message.userId) {
        value.pervExportUser = false;
        value.updateView();
      }
    });
  }
}
